<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
        <input type="text" placeholder="请输入数字" id="num1">
        <input type="text" placeholder="请输入数字" id="num2">
        <input type="button" value="最大公倍数" id="btn">
        <p id="p"></p>
</body>
<script>
    var btn = document.getElementById('btn');
    var p = document.getElementById('p');
    btn.onclick = function() {
        var num1 = document.getElementById('num1').value * 1;
        var num2 = document.getElementById('num2').value * 1;
        var max = num1 > num2 ? num1 : num2;
        for(var i = max;i >= 1;i++){
            if(i % num1 == 0 && i % num2 == 0){
                p.innerHTML = '最大公倍数为' + i;
                break;
            }
        }
    }
</script>
</html>